package com.kyrie.lib_sys.application.timeApplys.controller;


import com.kyrie.lib_sys.application.timeApplys.service.LimitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/limit")
@Slf4j
public class LimitOperation {

    @Autowired
    private LimitService limitService;
    /**
     * 限流接口
     * @return
     */
    @GetMapping("/test")
    public String test(@RequestHeader("token") String token) {
        if (limitService.limitTest(token)) {
            return "请求过于频繁，请稍后再试";
        }
        // 正常业务逻辑
        return "success";
    }

}
